{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=3121
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	kk:longint;
	s:string;
	f:boolean;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(s);
kk:=pos('f',s);
f:=true;
if kk>0 then s[kk]:='?' else f:=false;
kk:=pos('f',s);
if not f then dec(kk);
writeln(kk-1);
end.